package day07;

import java.util.Scanner;

public class HW2 {
/*定义一个方法用于判断用户输入的年份是否为闰年。 */
    public static void main(String[] args) {

        try (Scanner scanner = new Scanner(System.in)) {
            System.out.print("请输入年份: ");
            int year = scanner.nextInt();
            
            if (isLeapYear(year)) {
                System.out.println(year + "年是闰年");
            } else {
                System.out.println(year + "年不是闰年");
            }
        }
    }
    public static boolean isLeapYear(int year) {

        return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);

    }
}
